package io;

import java.io.*;

public class CopyDemo {
    public static void main(String[] args) throws IOException {
        File file=new File("1.jpg");
        System.out.println("图片大小："+file.length());
        FileInputStream fis=new FileInputStream("1.jpg");
        FileOutputStream fos=new FileOutputStream("1_copy.jpg");
        int d=0;
        long start=System.currentTimeMillis();
        while((d= fis.read())!=-1){
            fos.write(d);//将读出来的字节，写入到要复制的文件中
        }
        long ends=System.currentTimeMillis();
        System.out.println("复制完毕！耗时："+(ends-start));

        fis.close();
        fos.close();
    }
}
